package Demo2;

import java.util.Scanner;

public class Demo15 {
    public static int flag=0;

    public static void main(String[] args) {
Thread t1=new Thread(()->{
    while (flag==0){

    }
    System.out.println("t1线程结束");
});

Thread thread=new Thread(()->{
    System.out.println("请输入flag的值");
    Scanner scanner=new Scanner(System.in);
    flag=scanner.nextInt();
});
        thread.start();
        t1.start();

    }
}
